package com.onec.service.manage.service.kafka;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.support.MessageBuilder;

/**
 * 卡法卡 sendservice
 */
@EnableBinding(Source.class)
public class SendService {

    @Autowired
    private Source source;

    public void sendMsg(String message) {
        System.out.println("发送消息：" + message);
        boolean result = source.output().send(MessageBuilder.withPayload(message).build());
        System.out.println("执行结果：" + result);
    }
}
